home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / SAS-C / sc655pch / guiprof / guiprofpriv.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-26  |  3.5 KB  |  134 lines

  1. /*-------------------------------------------------------------------*/
  2. /* Copyright (c) 1993 by SAS Institute Inc., Cary NC                 */
  3. /* All Rights Reserved                                               */
  4. /*                                                                   */
  5. /* SUPPORT:    walker - Doug Walker                                  */
  6. /*-------------------------------------------------------------------*/
  7. #define __USE_SYSBASE 1
  8. #include <exec/types.h>
  9. #include <dos/doshunks.h>
  10. #include <time.h>
  11.  
  12. #define TIMERINTERVAL 5000   /* in milliseconds */
  13.  
  14. #if DODEBUG
  15. #include <stdarg.h>
  16. #include <stdio.h>
  17. #define IFDEBUG(x) x
  18. #define BUG(x) {if(dodebug) bug x ;}
  19. void bug(char *fmt, ...);
  20. extern int dodebug;
  21. #define FUNCENTRY BUG((__FUNC__ ": entry\n"))
  22. #else
  23. #define IFDEBUG(x)
  24. #define BUG(x)
  25. #define FUNCENTRY
  26. #endif
  27.  
  28. #include "memwatch.h"
  29.  
  30. #define SPROFPORT "SPROF_Profiler"
  31.  
  32. typedef unsigned long sptime;
  33.  
  34. struct SPDAT
  35. {
  36.    char *id;        // id of function (NULL for ignore)
  37.    sptime clk;      // Clock at entry
  38.    sptime subrs;    // Amount of time spent in subroutines
  39.    sptime off;      // Amount of time under PROFILE_OFF
  40. };
  41. #define SIZSPDAT sizeof(struct SPDAT)
  42.  
  43. extern struct SPDAT *spdat;
  44. extern int spcur, spmax;
  45. extern int autoexit;
  46. extern int broken;
  47. extern int axis;
  48. extern int sortby;
  49. extern int fullnames;
  50. extern char nullid[];
  51. #define SPINCR 500
  52.  
  53. #define GPINAME(x) (fullnames ? (x)->fullname : (x)->name)
  54.  
  55. typedef struct SPROFMSG
  56. {
  57.    struct Message m;
  58.    ULONG process;
  59.    sptime clk;
  60.    char *id;
  61.    ULONG a7;
  62.    ULONG flags;
  63. } *SPM;
  64.  
  65. #define SIZSPM sizeof(struct SPROFMSG)
  66.  
  67. /* Values for the 'flags' field of SPROFMSG */
  68. #define SPROF_INIT   0x00000001  // Initialize connection
  69. #define SPROF_ENTRY  0x00000002  // Function entry
  70. #define SPROF_EXIT   0x00000004  // Function exit
  71. #define SPROF_TERM   0x00000008  // Terminate connection, program continues
  72. #define SPROF_ABORT  0x00000010  // Abort program
  73. #define SPROF_DENIED 0x00000020  // Connection refused
  74.  
  75. struct GPInfo
  76. {
  77.    char *id;       // Used for sorting while program is in mem
  78.    char *name;     // Name of function
  79.    char *fullname; // Name and location of function
  80.    sptime time;    // Time excluding subroutines
  81.    sptime tottime; // Time including subroutines
  82.    USHORT count;    // Number of calls
  83.    
  84.    /* The following fields are used for creating the report while the */
  85.    /* program is running.                                             */
  86.    short rptindx;    // Index on screen of last report
  87.    short rptnamelen; // Length in characters to which name should be trunc
  88.    USHORT histlen;
  89.    ULONG stkval;
  90.    ULONG histval;
  91. };
  92.  
  93. extern struct GPInfo **GPInfo;
  94. extern int GPCur, GPMax;
  95. #define SIZGPINFO sizeof(struct GPInfo)
  96. #define GPINCR 256
  97.  
  98. int InitReport(void);
  99. void Report(sptime now);
  100. void DoTitle(char *);
  101. char *FuncName(char *);
  102. struct GPInfo *FindGPI(struct GPInfo ***GPInfo, char *id,
  103.                        int *cur, int *tot);
  104.  
  105. /* Functions defined in timer.c */
  106. long OpenTimer(void);
  107. void _STDCloseTimer(void);
  108. #define CloseTimer() _STDCloseTimer()
  109. void PostTimerReq(long time);
  110. void GetTimerPkt(long time, int wait);
  111.  
  112. extern int report_type;
  113. #define RPT_PCT   0
  114. #define RPT_ETIME 1
  115. #define RPT_ITIME 2
  116. #define RPT_CNT   3
  117.  
  118. #define MENU_HIST    0
  119. #define MENU_OPT     1
  120.  
  121. #define HIST_PCT     1
  122. #define HIST_ETIME   2
  123. #define HIST_ITIME   3
  124. #define HIST_CNT     4
  125. #define HIST_QUIT    5
  126.  
  127. #define OPT_SORTNUM    1
  128. #define OPT_SORTALPHA  2
  129. #define OPT_AXIS       3
  130. #define OPT_FULLNAME   4
  131.  
  132. #define SORTBY_NUM   1
  133. #define SORTBY_ALPHA 2
  134.